{extend name="layout" /}
{block name="head"}
<script type="text/javascript">var yyuc_jspath = "__STATIC__/";</script>
<link type="text/css" href="/WdatePicker.css">
<script type="text/javascript" src="__DATEPICKER__/WdatePicker.js"></script>
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
<style>
    .red {
        color: red;
    }
</style>
{/block}
{block name="button"}
{if authCheck('role/roleadd')}
&nbsp;<button type="button" onclick="add()" class="btn btn-mystyle btn-sm">添加商品</button>
{/if}
{/block}
{block name="content"}
<div class="search-box row">
    <form action="" method="post">
        <div class="col-md-8">
            <div class="form-group">
                <span class="pull-left form-span">注册时间:</span>
                <input type="text" class="form-control" style="width:160px;" placeholder="选择时间" name="start" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="{$start?:''}" readonly>
            </div>
            <div class="form-group">
                <span class="pull-left form-span">到</span>
                <input type="text" class="form-control" style="width:160px;" placeholder="选择时间" name="end" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="{$end?:''}" readonly>
            </div>
            <div class="form-group btn-search">
                <button class="btn btn-default" ><span class="glyphicon glyphicon-search"></span> 搜索</button>
            </div>
        </div>
    </form>
</div>
<div class="clearfix"></div>
<div class="table-margin">
    <table class="table table-bordered table-header" id="list-table">
        <thead>
        <tr>
            <td>图片</td>
            <td>名称</td>
            <td>分类</td>
            <td>库存</td>
            <td>价格</td>
            <td>排序</td>
            <td>是否推荐</td>
            <td>状态</td>
            <td>操作</td>
        </tr>
        </thead>
        <tbody>
        {foreach name="list" item="vo"}
        <tr>
            <td>{$vo['img']}</td>
            <td>{$vo['name']}</td>
            <td>{$vo['cat_id']}</td>
            <td>{$vo['stock']}</td>
            <td>{$vo['price']}</td>
            <td>{$vo['number']}%</td>
            <td>{$vo['is_hot']}ml</td>
            <td>{$vo['status']}ml</td>
            <td></td>
        </tr>
        {/foreach}
        </tbody>
        <tfoot>
        <tr>
            <td colspan="11">
                <div class="pull-right">
                    <nav>
                        <ul class="pagination">{$list->render()}</ul>
                    </nav>
                </div>
            </td>
        </tr>
        </tfoot>
    </table>
</div>
<script type="text/javascript">
    function userDel(id){
        layer.confirm('确认删除此商品?', {icon: 3, title:'提示'}, function(index){
            //do something
            $.getJSON("{:url('user/userDel')}", {'id' : id}, function(res){
                showSuccess(res);
            });
            layer.close(index);
        })
    }
</script>
{/block}